﻿''' <summary>
''' Format des données d'une variable
''' </summary>
''' <remarks></remarks>
<Serializable()> Public Class FormatChamps
    Inherits PTIC_Util.BaseNotifyPropertyChangeComponentModel

#Region "Variables de classe"

    'Type de stockage
    Protected _typeStock As Type
    'Type d'affichage
    Protected _typeAff As Type
    'Format d'affichage (utile pour spécifier l'affichage à utiliser dans les dataGridView)
    Protected _formatAff As String

#End Region

#Region "Constructeur"
    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub New()
        _typeAff = Nothing
        _typeStock = Nothing
        _formatAff = ""
    End Sub
    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub New(ByVal typeStock As Type, ByVal typeAff As Type)
        _typeStock = typeStock
        _typeAff = typeAff
        _formatAff = ""
    End Sub
    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Public Sub New(ByVal typeChamps As Type)
        _typeStock = typeChamps
        _typeAff = typeChamps
        formatAff = ""
    End Sub
#End Region

#Region "propriétés"

    ''' <summary>
    ''' Type de stockage
    ''' </summary>
    Public Property typeStock() As Type
        Get
            Return _typeStock
        End Get
        Set(ByVal value As Type)
            OnPropertyChanging("typeStock")
            _typeStock = value
            OnPropertyChanged("typeStock")
        End Set
    End Property

    ''' <summary>
    ''' Type d'affichage
    ''' </summary>
    Public Property typeAff() As Type
        Get
            Return _typeAff
        End Get
        Set(ByVal value As Type)
            OnPropertyChanging("typeAff")
            _typeAff = value
            OnPropertyChanged("typeAff")
        End Set
    End Property

    ''' <summary>
    ''' Format d'affichage
    ''' </summary>
    ''' <value></value>
    ''' <returns></returns>
    ''' <remarks></remarks>
    Public Property formatAff() As String
        Get
            Return _formatAff
        End Get
        Set(ByVal value As String)
            OnPropertyChanging("formatAff")
            _formatAff = value
            OnPropertyChanged("formatAff")
        End Set
    End Property

#End Region

#Region "Manipulation de l'objet"
    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Public Function copy()
        Dim copyChamps As New FormatChamps(_typeStock, _typeAff)
        copyChamps._formatAff = _formatAff
        Return copyChamps
    End Function
    ''' <summary>
    ''' 
    ''' </summary>
    ''' <remarks></remarks>
    Public Function estEgal(ByVal formatComparaison As FormatChamps) As Boolean
        Dim result As Boolean = False
        If Not formatComparaison Is Nothing Then
            If formatComparaison._typeAff.Name = _typeAff.Name And _
               formatComparaison._typeStock.Name = _typeStock.Name Then 'And _
                'formatComparaison._formatAff = _formatAff Then
                result = True
            End If
        End If
        Return result
    End Function
#End Region

End Class
